﻿using MediatR.Core.Controller;
using Microsoft.AspNetCore.Builder;
using Microsoft.Extensions.DependencyInjection;

namespace MediatR.Core
{
    internal class Program
    {
        static async Task Main(string[] args)
        {
            IServiceCollection services = new ServiceCollection();
            services.AddMediatR(cfg => cfg.RegisterServicesFromAssemblyContaining<Program>());
            services.AddScoped<MyController>();
            IServiceProvider serviceProvider = services.BuildServiceProvider();
            MyController controller = serviceProvider.GetRequiredService<MyController>();
            await controller.Get("111");
            await controller.Post("111");
            Console.WriteLine("Hello, World!");
        }
    }
}
